<template>
    <z-table name="1245mlbv" :entitys="entitys">
        <template #permissionSlot="formdata">
            <z-form-items name="permission" :fields="permissionFields" :value="formdata" />
        </template>
        <template #signSlot="formdata">
            <z-form-items name="sign" :fields="signFields" :value="formdata" />
        </template>
    </z-table>
</template>

<script>
import configs from './.lowcode/configs';

export default {
    name: 'p-1245mlbv',
    provide: { configs },
    props: {
        formData: Object,
    },
    data() {
        return {
            entitys: {
                party: {
                    type: 'table',
                    fields: [
                        {
                            label: "标识",
                            name: "label",
                            type: "select",
                            code: "partyLabel"
                        },
                        {
                            label: "签署方",
                            name: "signer",
                            type: "search",
                            depend: "party",
                            tenant: true
                        },
                    ]
                },
                inorout: {
                    default: 1,
                    onChange: (val, formData) => {
                        formData.total = val === 1 ? 0 : formData.total;
                    },
                },
                currency: {
                    default: 1
                },
                categoryId: {
                    depend: "category",
                    tenant: 'companyId',
                },
                templateId: {
                    label: '合同模版', type: 'templateSelect', tenant: 'companyId',
                },
                total: {
                    default: 0,
                    readonly: (formData) => formData.inorout === 1
                },
                related: {
                    type: "search",
                    depend: "contract",
                    multiple: true,
                    tenant: 'companyId'
                },
                local: {
                    type: "search",
                    depend: "contract",
                    multiple: true,
                },
                performParty: {
                    tenant: 'companyId',
                }
            },
            permissionFields: [
                {
                    label: "意见",
                    name: "status",
                    type: "radiobox",
                    options: [{ label: '同意', value: "1" }, { label: '拒绝', value: "0" }]
                },
                {
                    label: "说明",
                    name: "explain",
                    type: "textarea",
                },
            ],
            signFields: [
                {
                    label: "意见",
                    name: "status",
                    type: "radiobox",
                    options: [{ label: '同意', value: "1" }, { label: '拒绝', value: "0" }]
                },
                {
                    label: "双章合同",
                    name: "double",
                    type: "attach",
                },
                {
                    label: "说明",
                    name: "explain",
                    type: "textarea",
                },
            ]
        }
    },
}
</script>
